<?php
#
# REQUIRE
#
require_once dirname(__FILE__).'/__c.PayPal.php';

#
# SECURITY POLICIES
#
if ($PARAMS['_action'] != 'logout') {
	$CONFIG['session.secure'] = false;
}

#
# GENERAL ACTIONS
#
function action_process($p) {
	return action_default($p);
}

#
# DEFAULT ACTION
#
function action_default($p) {
	global $CONFIG;

	$paypal = new PayPal;

	$paypal->add_field('business', $CONFIG['paypal.business']);
	$paypal->add_field('return', $CONFIG['paypal.onreturn']);
	$paypal->add_field('cancel_return', $CONFIG['paypal.oncancel']);
	$paypal->add_field('notify_url', $CONFIG['paypal.onnotify']);
	$paypal->add_field('item_name', isset($p['item_name'])?$p['item_name']:'Paypal Test Transaction');
	$paypal->add_field('amount', isset($p['amount'])?$p['amount']:'0.00');

	$paypal->auto_submit_paypal_post();
}
